using System;
using System.Text;

namespace ASClass
{
    public class KlasaPrzetwarzaniaStringow
    {
    static string MinutesText="mins";
    static string HoursText="h";
    static string MinutesShortId = "m";
    static string HoursShortId = "h";
        static public string TimeSpanToString2(TimeSpan Span)
        {
            string Text = "";
            TimeSpan SpanOneHour = new TimeSpan(0, 1, 0, 0);
            TimeSpan SpanOneMinute = new TimeSpan(0, 0, 1, 0);
            int Hour = Span.Hours;
            int Minutes = Span.Minutes;
            int Seconds = Span.Seconds;
            if (TimeSpan.Compare(Span, SpanOneMinute) < 0)
            { // Less than one minute
                Text = string.Concat(Minutes.ToString(), ":", Seconds.ToString("00"), " ",MinutesText);
            }
            else
                if (TimeSpan.Compare(Span, SpanOneHour) < 0)
                { // Less than one hour
                    Text = string.Concat(Minutes.ToString(), ":", Seconds.ToString("00"), " ", MinutesText);
                }
                else
                { // More than one hour
                    Text = string.Concat(Hour.ToString(), ":", Minutes.ToString("00"), " ",HoursText);
                }
            return Text;
        }
        static public string MinutesToText(int Minutes)
        {
            string Text;
            int Hours = Minutes / 60;
            Minutes = Minutes % 60;
            if (Hours > 0)
            {
                if (Minutes > 0) Text = string.Concat(Hours.ToString(), ":", Minutes.ToString("00")," ", MinutesText);
                else Text = string.Concat(Hours.ToString(), " ", HoursText);
            }
            else
            {
                Text = string.Concat(Minutes.ToString(), " mins");
            }
            return Text;
        }
    }
}
